function test_01() {
	alert("hello world");

	var name = "lichangchun";
	var age = 20;
	console.log(`${name}今年${age}岁`);

	//字符串方法
	var test = "Welcome to chongqing";
	console.log(test.length);
	console.log(test.toUpperCase());
	console.log(test.substring(0, 10));

	//数组
	var arr = ["112", "115", "sdada"];
	console.log(arr);
	console.log(arr.length);
	console.log(arr[1]);
	arr.push("lllaa");
	console.log(arr);
	arr.sort();

	console.log(arr.join("-"));

	//对象
	var student = {
		id: 1,
		name: "lichanghcun",
		city: "chongqing",
	};
	console.log(student);
	console.log(student.name);

	//map
	var map = new Map();
	map.set("name", "lichanghchun");
	map.set("agee", 20);
	map.set("city", "chongqing");
	console.log(map);

	//set
	var set = new Set();
	set.add(5);
	set.add(8);
	console.log(set);

	//运算符
	console.log(5 / 3);
	console.log(-5 % 3);
	console.log(1 == "1");
	console.log([1, 2, 3] == new Array(1, 2, 3));
	console.log([1 == 1]);
	console.log(null == undefined);
	console.log(null === undefined);
	console.log(NaN == NaN);

	//判断
	var age = 18;
	if (age <= 18) {
		console.log("少年");
	} else if (age > 18 && age <= 40) {
		console.log("中壮年");
	} else {
		console.log("晚年");
	}

	//for循环
	var i;
	for (i = 0; i < arr.length; i++) {
		console.log(arr[i]);
	}

	for (var i in arr) {
		console.log(i);
		console.log(arr[i]);
	}

	for (var item of arr) {
		console.log(item);
	}

	arr.forEach(function (item) {
		console.log(item);
	});

	//方法
	var person = {
		name: "lichangchun",
		birth: 2002,
		age: function () {
			var y = new Date().getFullYear;
			return y - this.birth;
		},
	};
	console.log(person.age);
	console.log(person.age());

	//高阶函数
	var arr2 = [1, 3, 5, 4, 2, 9, 6];
	arr2.forEach((item) => console.log(item));
	//包装
	var arr1 = arr2.map((item) => item * 3);
	console.log(arr1);

	//累加
	var sum = 0;
	arr2.forEach(function (item) {
		sum += item;
	});
	console.log(sum);

	console.log(arr2.reduce((a, b) => a + b));

	//元素过滤
	console.log(arr2.filter((item) => item % 2 == 0));

	//排序
	console.log(arr2.sort((a, b) => a - b));

	//日期
	var date = new Date(1615146562875);
	console.log(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());

	//正则
	var reg = /ABC\-001/;
	console.log(reg.test("http://www.sfac.xyz:8000/notes/UI/Html.html"));

	//JSON
	console.log(student);
	//序列化
	console.log(JSON.stringify(student));
}
